<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ร้านข้าวแกง</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />


<script type="text/javascript">
function urlEncode( s )
{
	return encodeURIComponent( s ).replace( /\%20/g, '+' ).replace( /!/g, '%21' ).replace( /'/g, '%27' ).replace( /\(/g, '%28' ).replace( /\)/g, '%29' ).replace( /\*/g, '%2A' ).replace( /\~/g, '%7E' );
}

function urlDecode( s )
{
  return decodeURIComponent( s.replace( /\+/g, '%20' ).replace( /\%21/g, '!' ).replace( /\%27/g, "'" ).replace( /\%28/g, '(' ).replace( /\%29/g, ')' ).replace( /\%2A/g, '*' ).replace( /\%7E/g, '~' ) );
}

function GetXMLHTTP()
{   
	//HttpRequest
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlhttp;
}

function AddSession(uid, uname, uprice)
{
		var xmlhttp = GetXMLHTTP();

		xmlhttp.onreadystatechange=function()
		 {
			if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				//alert(xmlhttp.responseText);
				if( xmlhttp.responseText == "OK" )
				{
					//alert('ได้รับข้อมูลเรียบร้อยแล้วค่ะ');
					//document.location.reload();
					//document.getElementById('aaa').src="<div>555</div>";
				}
//				else
//					alert('เกิดข้อผิดพลาด ไม่สามารถลบข้อมูลได้ค่ะ');
			}
		}
		uname = urlEncode(uname);
		xmlhttp.open("GET","fn_session_add.php?uid="+uid+"&uname="+uname+"&uprice="+uprice,false);
		xmlhttp.send();			
}

function RefreshList()
{
	var xmlhttp = GetXMLHTTP();

	xmlhttp.onreadystatechange=function()
	 {
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			//alert(xmlhttp.responseText);
			document.getElementById('FoodList').innerHTML = xmlhttp.responseText;
		}
	}

	xmlhttp.open("GET","fn_refresh_foodlist.php",false);
	xmlhttp.send();			
}

function AddSessionList(uid, uname, uprice)
{
	AddSession(uid, uname, uprice);
	RefreshList();
}


</script>
</head>

<body onLoad="RefreshList()">
	<div id="wrapper">
    	<div id="header-admin">
        	
        	<div id="main-menu">
            	<table align="right">
                	<tr>
                    	<td><a href="#">รับคำสั่งซื้อ</a></td>
                    	<td><a href="#">รับคำสั่งซื้อ</a></td>
                    </tr>
                	<tr>
                	  <td>&nbsp;</td>
                	  <td>&nbsp;</td>
              	  </tr>
                	<tr>
                	  <td>&nbsp;</td>
                	  <td>&nbsp;</td>
              	  </tr>
                </table>
            </div>
           <div id="logo">
            <a href="#">
                      <img src="images/logo-curryshop.png" alt="" width="276" height="35" />
             </a>
		  </div>
            
      </div>
        <div id="content">
        	<div class="content_right">
            	<p>
                	<strong>เลือกประเภทอาหาร</strong>
                 </p>
            	<table align="center">
                	<tr>
                    	<td>
                            <a href="#">
                                <img src="images/type_plate.png" border="0">
                            </a>
                        </td>
                        <td>
                            <a href="#">
                                <img src="images/type_plate2.png" border="0">
                            </a>
                        </td>
                         <td>
                             <a href="#">
                                 <img src="images/gohome.png" border="0">
                             </a>
                        </td>
                    </tr>
                </table>
            	<p><strong>รายการอาหารประจำวันที่ 14 เมษายน 2555</strong></p>
                <table align="center">
                	<tr>
                    	<td class="food">
<a href="javascript:AddSessionList(1, '[ราดข้าว]พะโล้', 20 )">
                            	<span>พะโล้หมู</span>
	                                <img src="images/f1.png" width="160" height="100">
                            </a>
                         </td>
                      <td class="food">
<a href="javascript:AddSessionList(2, '[ราดข้าว]แกงเลียง', 25 )">
                          	<span>แกงเลียง</span>
                            <img src="images/f2.png" width="160" height="100">
                          </a>
                      </td>
                      <td class="food">
<a href="javascript:AddSessionList(3, '[จานเดี่ยว]แกงจืดมะระ', 25 )">
                          	<span>แกงจืดมะระ</span>
                          	<img src="images/f3.png" width="160" height="100">
                          </a>
                      </td>
                    </tr>
                	<tr>
                    	<td class="food">
<a href="#">
                            	<span>พะโล้หมู</span>
                                <img src="images/f1.png" width="160" height="100">
                            </a>
                         </td>
                      <td class="food">
<a href="#">
                          	<span>แกงเลียง</span>
                            <img src="images/f2.png" width="160" height="100">
                          </a>
                      </td>
                      <td class="food">
<a href="#">
                          	<span>แกงจืดมะระ</span>
                          	<img src="images/f3.png" width="160" height="100">
                          </a>
                      </td>
                    </tr>
                    <tr>
                    	<td class="food">
<a href="#">
                            	<span>พะโล้หมู</span>
                                <img src="images/f1.png" width="160" height="100">
                            </a>
                         </td>
                      <td class="food">
<a href="#">
                          	<span>แกงเลียง</span>
                            <img src="images/f2.png" width="160" height="100">
                          </a>
                      </td>
                      <td class="food">
<a href="#">
                          	<span>แกงจืดมะระ</span>
                          	<img src="images/f3.png" width="160" height="100">
                          </a>
                      </td>
                    </tr>
                    <tr>
                    	<td class="food">
<a href="#">
                            	<span>พะโล้หมู</span>
                                <img src="images/f1.png" width="160" height="100">
                            </a>
                         </td>
                      <td class="food">
<a href="#">
                          	<span>แกงเลียง</span>
                            <img src="images/f2.png" width="160" height="100">
                          </a>
                      </td>
                      <td class="food">
<a href="#">
                          	<span>แกงจืดมะระ</span>
                          	<img src="images/f3.png" width="160" height="100">
                          </a>
                      </td>
                    </tr>
                </table>
               
        </div>
            <div class="content_left">
            	<div id="FoodList">
            		<table width="396">
                    	<tr>
                        	<td colspan="3">
                            	<strong>รายการอาหารที่สั่งซื้อ</strong>
                            </td>
                   	  </tr>
                    	<tr align="center" bgcolor="#FF9900">
                    	  <td width="50"><strong>ลำดับ</strong></td>
                          <td width="206"><strong>รายการอาหาร</strong></td>
                          <td width="124"><strong>ราคา (บาท)</strong></td>
                  	  </tr>
                    	<tr>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    	<tr bgcolor="#FFCC99">
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    	<tr>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    	<tr bgcolor="#FFCC99">
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    	<tr>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    	<tr bgcolor="#FFCC99">
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    	<tr>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    	<tr bgcolor="#FFCC99">
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                    	  <td>&nbsp;</td>
                  	  </tr>
                    </table>
				</div>

                    <p align="right">
                    	<a href="#">
                        	<img src="images/btn_23.png" border="0">
                        </a>    
                    </p>
            </div>
        </div>
        <div class="clear"></div>
        <div id="footer">
        	<table width="969">
            	<tr>
                	<td width="866">
                    		<p>
                            	Admin Skin &copy; Copyright Khoakang BSD5EX.
                            </p>
                    </td>
                    <td width="91">
                    	<a href="#">
                            <img src="images/logout.png" border="0"  />
                            </a>
                    </td>
                </tr>
            </table>
        	
      </div>
    </div>
</body>
</html>
